require('dotenv').config()

const koa = require('koa')
const serve = require('koa-static')
const logger = require('koa-logger')
const service = require('./routes/service')

const app = koa()

app.use(logger())

app.use(serve(__dirname + '/public'))

app.use(service.routes())

if (!module.parent) {
  app.listen(3333)
}

module.exports = app
